package Data::Conveyor::Service::Result;

# $Id: Result.pm 13653 2007-10-22 09:11:20Z gr $

use strict;
use warnings;
use YAML;


our $VERSION = '0.02';


use overload
    '""'     => 'stringify',
    fallback => 1;


use base 'Data::Conveyor::Service';


__PACKAGE__->mk_scalar_accessors(qw(result exception));


sub is_ok {
    my $self = shift;
    my $E = $self->exception;
    !(defined $E && ref $E);
}


sub stringify {
    my $self = shift;
    return sprintf("%s\n", $self->exception) unless $self->is_ok;
    $self->result_as_string;
}


# dummy; subclasses should override this

sub result_as_string { sprintf "%s" => $_[0]->result }


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - stage-based conveyor-belt-like ticket handling system

=head1 SYNOPSIS

    {% p.package %}->new;

=head1 DESCRIPTION

None yet. This is an early release; fully functional, but undocumented. The
next release will have more documentation.

=head1 METHODS

=over 4

{% p.write_methods %}

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

